<?php
defined('_JEXEC') or die;
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
$column = 4;
$text = 100;
?>
<div class="catSubList">
<?php foreach($this->items[$this->parent->id] as $id => $item) : ?>
	<?php
	if ($this->params->get('show_empty_categories_cat') || $item->numitems || count($item->getChildren())) :
	?>
	<div class="subCat<?php if(($id+1)%$column == 0):?> last<?php endif;?>">

    	<div class="subCatImage">
    	<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id));?>"><img src="<?php echo $item->getParams()->get('image'); ?>" alt="<?php echo $this->escape($item->title); ?>" title="<?php echo $this->escape($item->title); ?>"/></a>
        </div>
        <div class="subCatTitle">
        <h3><a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id));?>">
			<?php echo $this->escape($item->title); ?></a>
		</h3>
        </div>
        
		<?php if ($this->params->get('show_subcat_desc_cat') == 1) :?>
		<?php if ($item->description) : ?>
		<div class="subCatDesc">        	
			<?php echo mb_substr(strip_tags(JHtml::_('content.prepare', $item->description)),0, $text, 'UTF-8'); if (strlen(strip_tags(JHtml::_('content.prepare', $item->description)))>$text) echo '...'; ?>
        </div>		
		<?php endif; ?>
        <?php endif; ?>
        
		<?php if ($this->params->get('show_cat_num_articles_cat') == 1) :?>
		<div class="subCatCounter">
				<?php echo JText::_('COM_CONTENT_NUM_ITEMS'); ?> <?php echo $item->numitems; ?>
		</div>
		<?php endif; ?>	
        
		<?php if (count($item->getChildren()) > 0) :
			$this->items[$item->id] = $item->getChildren();
			$this->parent = $item;
			$this->maxLevelcat--;
			echo $this->loadTemplate('sublink');
			$this->parent = $item->getParent();
			$this->maxLevelcat++;
		endif; ?>  
        <div class="clr"></div>       
	</div>
	<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>